﻿/*初始化菜单*/
var _menus = { "menus": [
						{ "menuid": "1", "icon": "icon-sys", "menuname": "系统管理",
						    "menus": [
									{ "menuid": "12", "menuname": "级别管理", "icon": "icon-smart", "url": "../Admin/Level" },
									{ "menuid": "14", "menuname": "会员管理", "icon": "icon-smart", "url": "../Admin/User" },
									{ "menuid": "15", "menuname": "权限设置", "icon": "icon-smart", "url": "demo.html" },
									{ "menuid": "16", "menuname": "系统日志", "icon": "icon-smart", "url": "demo1.html" }
								]
						}
				]
};
//设置登录窗口
function openPwd() {
    $('#w').window({
        title: '修改密码',
        width: 300,
        modal: true,
        shadow: true,
        closed: true,
        height: 160,
        resizable: false
    });
}
//关闭登录窗口
function closePwd() {
    $('#w').window('close');
}

//修改密码
function serverLogin() {
    var $newpass = $('#txtNewPass');
    var $rePass = $('#txtRePass');

    if ($newpass.val() == '') {
        msgShow('系统提示', '请输入密码！', 'warning');
        return false;
    }
    if ($rePass.val() == '') {
        msgShow('系统提示', '请在一次输入密码！', 'warning');
        return false;
    }

    if ($newpass.val() != $rePass.val()) {
        msgShow('系统提示', '两次密码不一至！请重新输入', 'warning');
        return false;
    }

    $.post('/ajax/editpassword.ashx?newpass=' + $newpass.val(), function (msg) {
        msgShow('系统提示', '恭喜，密码修改成功！<br>您的新密码为：' + msg, 'info');
        $newpass.val('');
        $rePass.val('');
        close();
    })

}

/*JQuery初始化*/
$(function () {

    $('#w').window('close');

    $('#editpass').click(function () {
        $('#w').window('open');
    });

    $('#btnEp').click(function () {
        serverLogin();
    })

    $('#btnCancel').click(function () { closePwd(); })

    $('#loginOut').click(function () {
        $.messager.confirm('系统提示', '您确定要退出本次登录吗?', function (r) {

            if (r) {
                location.href = '/ajax/loginout.ashx';
            }
        });
    })
});